package com.jspx.txweb.table;

import com.jspx.sober.annotation.Column;
import com.jspx.sober.annotation.IDType;
import com.jspx.sober.annotation.Id;
import com.jspx.sober.annotation.Table;
import com.jspx.sober.table.OperateTable;
import com.jspx.utils.StringUtil;

/**
 * 用户部门信息表，保持用户所在岗位部门信息
 */
@Table(name = "jspx_member_dept", caption = "用户部门信息表")
public class MemberDept extends OperateTable {
    @Id(auto = true, type = IDType.serial)
    @Column(caption = "ID", notNull = true)
    private long id;

    @Column(caption = "用户ID", notNull = true)
    protected long uid = 0;

    //昵称，中文名称方式登录
    @Column(caption = "昵称", length = 50, dataType = "isLengthBetween(2,32)", notNull = true)
    private String name = StringUtil.empty;

    //办公 或者店铺begin
    @Column(caption = "部门ID", length = 20)
    private String departmentId = StringUtil.empty;

    @Column(caption = "部门名称", length = 100)
    private String department = StringUtil.empty;
    //办公 end

    @Column(caption = "级别", option = "正厅级;副厅级;正处级;副处级;正科级;副科级;办事员;助工", length = 60)
    private String superior = StringUtil.empty;

    //通过配置支持
    @Column(caption = "岗位", length = 50)
    private String position = StringUtil.empty;

    @Column(caption = "默认", notNull = true)
    private int def = 0;


    public String getDepartment() {
        return department;
    }

    public String getDepartmentCaption() {
        if (StringUtil.isNULL(department) || !department.contains("/")) return department;
        return StringUtil.substringAfterLast(department, "/");
    }

    public void setDepartment(String department) {
        this.department = department;
    }


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getUid() {
        return uid;
    }

    public void setUid(long uid) {
        this.uid = uid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(String departmentId) {
        this.departmentId = departmentId;
    }

    public String getSuperior() {
        return superior;
    }

    public void setSuperior(String superior) {
        this.superior = superior;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public int getDef() {
        return def;
    }

    public void setDef(int def) {
        this.def = def;
    }
}
